const Comment = require("../models/Comment");

// 添加评论
exports.addComment = async (req, res) => {
  try {
    const { text, spotId } = req.body;
    const { id } = req.user;
    const comment = await Comment.create({
      text,
      spotId: spotId,
      userId: id,
    });
    res.json({ success: true });
  } catch (error) {
    console.log(error);
    res.status(500).send("Server Error");
  }
};
